package com.example.entity;

public class Teacher extends Person {
    private Course course;

    public Teacher(String id, String name, String gender) {
        super(id, name, gender);
    }

    public void teachCourse(Course course) {
        this.course = course;
        course.setTeacherId(super.getId());
    }

    @Override
    public void printWorkInfo() {
        if (course != null) {
            System.out.println("=====" + super.getName() + "的授课信息=====");
            System.out.println("教师ID：" + super.getId());
            System.out.println("教授课程：" + course.getName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("=================");
        } else {
            System.out.println(super.getName() + "暂无授课记录");
        }
    }

    public Course getCourse() {
        return course;
    }
}
